package www.rlicker.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import www.rlicker.dao.IOperationLogDao;
import www.rlicker.model.OperationLog;
import www.rlicker.mybatis.Criteria;
import www.rlicker.service.IOperationLogService;
import www.rlicker.utils.MessageConstant;
import www.rlicker.utils.TranslateToMap;

@Service
public class OperationLogServiceImpl implements IOperationLogService{


	public List<Map<String, Object>>  queryPage (Criteria<OperationLog> param){
		List<OperationLog> list = operationLogRepository.queryPage(param);
	    List<Map<String,Object>> map = TranslateToMap.convertListBean2ListMap(list,OperationLog.class);
	return map;  }

	public Integer queryPageCount (Criteria<OperationLog> param){
		return (Integer) operationLogRepository.queryPageCount(param);
	}

	public OperationLog  queryEntity (String id ){
		return operationLogRepository.queryEntity(id);
	}

	public String deleteById (String id ){
		int result = operationLogRepository.deleteById(id);
			if ( result != 1) {
					return MessageConstant.USER_TYPE_3;
			}
			return null;
	}

	public String insert(OperationLog record ){
		int result = operationLogRepository.insert(record);
			if ( result != 1) { 
					return MessageConstant.USER_TYPE_4;
			}
			return null;
	}

	public String update (Criteria<OperationLog> param){
		int result = operationLogRepository.update(param);
			if ( result != 1) { 
					return MessageConstant.USER_TYPE_5;
			}
			return null;
	}

	@Resource
	private IOperationLogDao operationLogRepository;

}